package com.reservation.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.reservation.entity.ExhibitionCollection;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 展览藏品关联Mapper接口
 */
@Mapper
public interface ExhibitionCollectionMapper extends BaseMapper<ExhibitionCollection> {
    
    /**
     * 根据展览ID查询关联的藏品ID列表
     *
     * @param exhibitionId 展览ID
     * @return 藏品ID列表
     */
    @Select("SELECT collection_id FROM exhibition_collection WHERE exhibition_id = #{exhibitionId} AND deleted = 0")
    List<Long> selectCollectionIdsByExhibitionId(@Param("exhibitionId") Long exhibitionId);
    
    /**
     * 根据藏品ID查询关联的展览ID列表
     *
     * @param collectionId 藏品ID
     * @return 展览ID列表
     */
    @Select("SELECT exhibition_id FROM exhibition_collection WHERE collection_id = #{collectionId} AND deleted = 0")
    List<Long> selectExhibitionIdsByCollectionId(@Param("collectionId") Long collectionId);
}